package com.whfc.wxmp.api.fmam.controller;

import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.wxmp.annotation.CurrentWxUser;
import com.whfc.fuum.entity.WxUser;
import com.whfc.fmam.entity.dto.FmamWeighRoomDTO;
import com.whfc.wxmp.api.fmam.service.WxFmamWeighRoomService;
import com.whfc.wxmp.util.RequestConetxtUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttribute;

import java.util.List;

/**
 * 物资-磅房
 *
 * @author : qzexing
 * @version : 1.0
 * @date : 2020/4/26 18:08
 */
@RestController
@RequestMapping("/mp/api/fmam/weighRoom")
public class WxFmamWeighRoomController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private WxFmamWeighRoomService wxFmamWeighRoomService;

    @RequestMapping("/list")
    public Result list(@CurrentWxUser WxUser wxUser,
                       @RequestParam("deptId") Integer deptId) {
        logger.info("WXMPUA|{}|{}|{}|{}|{}",
                wxUser.getId(), RequestConetxtUtil.getAppType(), RequestConetxtUtil.getPage(),
                "获取磅房列表", "{\"deptId\":\"" + deptId + "\"}");
        List<FmamWeighRoomDTO> list = wxFmamWeighRoomService.listWeighRoom(deptId);
        return ResultUtil.success(list);
    }

}
